#ifndef SDLPOPUPMENU_H
#define SDLPOPUPMENU_H

#include <SDL.h>
#include <SDL_ttf.h>
#include <vector>
#include <string>
#include <utility>
#include "SDLutil.h"
#include "SDLTextBox.h"

class SDLTextBox;

class SDLPopupMenu {
public:
	SDLPopupMenu();
	SDLPopupMenu::SDLPopupMenu(std::vector < std::pair < std::string, bool > > itemList, 
						   SDL_Color normal, SDL_Color grayed, SDL_Surface *pParent, SDL_Event *event, TTF_Font *font,
						   SDLTextBox *caller);
	~SDLPopupMenu();

	void inputHandler();

	void show(int x, int y);
	void hide();
	void addItem(std::string item, bool active);
	void subtractItem(int num);
	void render();
	void doHighlight(int num);
	void doAction(int num);
	void setParent(SDL_Surface *pParent);
	void setEvent(SDL_Event *event);
	void setActive(int num, bool state);
	bool isVisible();
	bool mustRender();
	int getCurrentItem();
private:
	SDL_Surface *m_Surface, *m_Parent;
	TTF_Font *m_Font;
	SDL_Rect m_dst, m_coords;
	SDL_Event *m_Event;
	SDLTextBox *m_pParent;
	std::vector < std::pair < std::string, bool > > m_List;
	//std::vector <T> mList;
	SDL_Color cNormal, cGray;
	bool m_isVisible, m_mustRender;
	int m_curr;
};

#endif
